/**
 * 功能描述
 */
define(function (require, exports, module) {
	var Component = require("grid");
	var aw = require("ajaxwrapper");
	var Dialog = require("dialog");
	var store =require("store");
	var activeUser = store.get("user");
	var Form = require("form");
	var proctrgrid = require("../constant/fetchProperties");
	
    var instance = {
        initComponent: function (params, widget) {
            var grid = new Component({
            	parentNode : ".J-detailgrid",	
            	url : "api/cate/travelaccountflow/query",
            	autoRender : false,
				params : function(){
					var subnav = widget.get("subnav");
					var obj = {
							"travelAccount": widget.get("pkTravelAccount"),
                			"servicePoint" : subnav.getValue("servicePoint"),
                			"operateDate" : subnav.getValue("operateDate").start,
                			"operateDateEnd" : subnav.getValue("operateDate").end,
                			"orderString" : "operateDate:desc",
                			fetchProperties : proctrgrid.detail
                	};
	    			return obj;
				},
				model : {
				 columns  : [{
					 name : "operateDate",
					 label : "时间",
					 format : "date",
					 formatparams : {
							mode : "YYYY-MM-DD HH:mm"
					 }
				 },{
					 name : "consumeType.value",
					 label : "类型",
				 },{
					 name : "money",
					 label : "金额(元)",
					 format: function(value){
						 if(value){
							 return parseFloat(value).toFixed(2);
						 }else{
							 return "0";
						 }
					 }
				 },{
					 name : "balance",
					 label : "余额(元)",
					 format: function(value){
						 if(value){
							 return parseFloat(value).toFixed(2);
						 }else{
							 return "0";
						 }
					 }
				 },{
					 name : "operator.name",
					 label : "操作人员",
				 },{
					 name : "description",
					 "break" : true,
					 label : "备注",
				 }]
				}
            });
            widget.set("detailGrid", grid);
        }
    };
    module.exports = instance;
});
